<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const a1 = new Promise((reslove,reject)=>{
            setTimeout(()=>{
                console.log('模拟第一个请求成功');
                reslove()
            },2000)
        })
        const a2 = new Promise((reslove,reject)=>{
            setTimeout(()=>{
                console.log('模拟第二个请求成功');
                reslove()
            },5000)
        });
        // console.log(a1);
        // console.log(a2);

    //     Promise.all([a1,a2]).then(()=>{
    //         console.log('两个请求已经成功');
    //     })
    // .catch(()=>{
    //     console.log('失败了');
    // })

    (async()=>{
        await Promise.all([a1,a2])
        console.log('两个请求成功了');
    })()
    </script>
</body>
</html>